package software.agileCourse2013.KillerGame.data.dao.implement;

import java.util.List;

import org.springframework.orm.hibernate3.support.HibernateDaoSupport;


import software.agileCourse2013.KillerGame.data.dao.Testdao;
import software.agileCourse2013.KillerGame.data.dataobject.Case;

public class testImpl extends HibernateDaoSupport implements Testdao {

	@Override
	public boolean addCase(Case caseDO) {
		if(caseDO == null){
			return false;
		}
		this.getHibernateTemplate().save(caseDO);
		return true;
	}

	@Override
	public Case getCaseById(int id) {
		String hql = "from Case where id = ?";
		@SuppressWarnings("unchecked")
		List<Case> res = this.getHibernateTemplate().find(hql,id);
		return res == null?null:res.get(0);
	}

}
